]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Disconnect to global signals on destruction
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 27 Nov 2025 23:28:12 +0000 (00:28 +0100)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 27 Nov 2025 23:32:52 +0000 (00:32 +0100)
The global display object has always a longer lifetime than anything
that is initialized from JS, so avoid signals that it may emit to be
handled at later point.

It handles issues such as:
  (gnome-shell:2429): Gjs-CRITICAL **: 23:18:35.025: Object
  Gjs_ui_messageTray_MessageTray (0x3440ed60), has been already disposed —
  impossible to set any property on it.
  This might be caused by the object having been destroyed from C code using
  something such as destroy(), dispose(), or remove() vfuncs.
  == Stack trace for context 0x31073eb0 ==
  #0       348db378 i   resource:///org/gnome/shell/ui/messageTray.js:1046 (3a8ac3a71f60 @ 104)
  #1       348db2d8 i   resource:///org/gnome/shell/ui/main.js:277 (3a8ac3a0b100 @ 119)

Seen in: https://gitlab.gnome.org/GNOME/gnome-shell/-/jobs/5846454

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3987>

js/ui/messageTray.js

index 76c3cf9897e405f182215217f1d5608b53b5d125..bf8725f1662cbd14d603c362befde5127aae9d17 100644 (file)
@@ -760,7 +760,8 @@ export const MessageTray = GObject.registerClass({
         Main.layoutManager.addChrome(this);
         Main.layoutManager.trackChrome(this._bannerBin);
 
-        global.display.connect('in-fullscreen-changed', this._updateState.bind(this));
+        global.display.connectObject('in-fullscreen-changed',
+            () => this._updateState(), this);
 
         Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));